feat: DBA simulator dialog and save-data-template action#29
Open
ahmadomira wants to merge 1 commit into
Open
Conversation
Adds two main-window entry points that lower the barrier to using the app: - A DBA Simulator dialog (toolbar + Tools menu) for experiment design — parameters drive a live PyQtGraph titration curve computed by the shared core.models.equilibrium.dba_signal, so no forward-model math is duplicated. - A "Save Data Template…" action that emits an example input file the existing readers accept, so users can format their data by example. Closes #23 Closes #24
There was a problem hiding this comment.
Pull request overview
Adds two user-facing conveniences to the GUI: a modeless DBA forward-simulation dialog (live PyQtGraph titration curve driven by core.models.equilibrium.dba_signal) and a “Save Data Template…” action that writes an example CSV/TXT file that round-trips through the real core.io.load_measurements readers.
Changes:
- Add
SimulatorDialog(DBA simulator) and wire it into the main window via toolbar + Tools menu action. - Add
write_data_template()helper and wire it into the main window via Import dropdown + File menu action. - Add unit tests covering simulator wiring and template round-trip behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
gui/main_window.py |
Adds actions/menu wiring for DBA Simulator dialog and Save Data Template flow. |
gui/dialogs/simulator_dialog.py |
Implements the modeless DBA simulator UI and live curve computation via dba_signal. |
core/io/template.py |
Implements CSV/TXT example template generator intended to round-trip through existing readers. |
tests/unit/gui/test_simulator_dialog.py |
Validates simulator widget→model wiring, mode behavior, and live updates. |
tests/unit/test_io_template.py |
Validates template output round-trips through load_measurements for both formats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for label, _mode, _x_species in _MODES: | ||
| self._mode.addItem(label) | ||
|
|
||
| self._ka = self._spin(0.0, 1e12, 0, 5e5, ' M⁻¹') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bundles two
gui/main_window.py-only conveniences (Package C).#23 — built-in DBA forward-simulation dialog
A DBA Simulator dialog (new
gui/dialogs/simulator_dialog.py), launched from a new toolbar button and the Tools menu. Parameter inputs —Ka,I0,I_dye_free,I_dye_bound,[Host]₀,[Dye]₀, plus a Host→Dye / Dye→Host direction toggle — drive a live PyQtGraph titration curve. The curve is computed by the shared, testedcore/models/equilibrium.pydba_signal.#24 — "Save Data Template…" action
A Save Data Template… action (Import dropdown + File menu) that writes a small example input file via a new
core/io/template.pyhelper..txt→ tab-separated repeated-header (var⇥signal) blocks;.csv→ long-formatconcentration,signal,replica. Headers match exactly whatcore/ioreaders expect, and the emitted file round-trips throughload_measurements. Assay-agnostic — it shows the format, not any binding model.Tests
tests/unit/gui/test_simulator_dialog.py— curve equalsdba_signalfor the widgets' values, mode switch retargets the titrant/fixed species, live update on parameter change, and a model-agnostic monotonicity check.tests/unit/test_io_template.py—.txt/.csvtemplates round-trip through the real readers with the expected shape and values.uv run pytest -k "simulator or template or io"→ 155 passed, 3 skipped.uv run ruff check/ruff formatclean.Closes #23
Closes #24